<template>
  <div>
    <div class="search">
      <form action="/">
        <van-search :label="`${current}  | `" disabled placeholder="点击搜索城市" @click="onCityList"> </van-search>
      </form>
      <div @click="onSearch" class="icon"><van-icon name="location-o" /></div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {}
  },
  computed: {
    current () {
      return localStorage.getItem('current') ? localStorage.getItem('current') : '未知'
    }
  },
  methods: {
    onSearch () {
      this.$router.push('/maphouse')
    },
    onCityList () {
      this.$router.push('/citylist')
    }
  }
}
</script>

<style lang="less" scoped>
/deep/ .van-search__content {
  padding: 0px;
}

/deep/ .van-search {
  padding: 0px;
  margin: 0px;
  margin-right: 12px;
  padding: 0 10px;
  border-radius: 5px;
}

/deep/ .van-search__content {
  background-color: #fff;
}

.icon {
  position: absolute;
  right: -20px;
  top: 7px;
}
</style>
